// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init({
  env:'sudden-3gzfypks0b9196f8'
})

// 云函数入口函数
exports.main = async (event, context) => {
  const wxContext = cloud.getWXContext()
  const db = cloud.database()
  const collectionDirection = db.collection('bannerinfo')
  const images = await collectionDirection.aggregate()
  .project({
    _id:0
  })
  .end()

  return {
    event,
    openid: wxContext.OPENID,
    appid: wxContext.APPID,
    unionid: wxContext.UNIONID,
  }
}